package com.adhere.auth.utils;

import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;

/**
 * @author WT
 * @date 2022/02/07 16:45:35
 */
public class ServletUtils {

    public static HttpServletRequest getRequest() {

        try {
            ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
            return servletRequestAttributes.getRequest();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }

    }

}
